<?php
    $entities = pc_variable("entities");
    $id = pc_variable("id");
    $typeName = pc_variable("typeName");
    $typeConfig = pc_config("cm.type." . $typeName);
    $name = $typeConfig->getPrimaryPropertyName();
    if($entities->isEmpty()) { ?><option value="">
        (<?php pc_echo(pc_message("showEntity.empty", array(Pageley_Util_String::uncapitalize(pc_message("namespace." . $typeName . ".plural"))))); ?>)
    </option><?php }
    foreach($entities as $entity) { ?>
        <option value="<?php pc_echo($entity->getId()); ?>"<?php if($id == $entity->getId()) {?> selected="selected"<?php } ?>>
            <?php pc_echo($entity->get($name)); ?>
        </option>
<?php } ?>